package com.ecnu.jiagou.damai.controller;

import java.util.List;

import com.ecnu.jiagou.damai.entity.Show;
import com.ecnu.jiagou.damai.result.Result;
import com.ecnu.jiagou.damai.service.ShowService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/index")
public class IndexController {

    @Autowired
    private ShowService showService;

    /**
     * 根据表演类型获取近期安排的7场演出
     */
    @GetMapping("/category")
    public Result<List<Show>> defaultPage(@RequestParam("type") int type,@RequestParam("city") String city){
        
        return showService.getShowByType(type,city);
    }

    /**
     * 获取置顶演出安排信息
     * @return
     */
    @GetMapping("/top")
    public Result<List<Show>> indexPage(String city){
        
        return showService.getShowByTop(city);
    }
    
}
